// AWTTextField.h: interface for the AWTTextField class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_AWTTEXTFIELD_H__DCE3E985_423F_11D2_A3F2_006097A44215__INCLUDED_)
#define AFX_AWTTEXTFIELD_H__DCE3E985_423F_11D2_A3F2_006097A44215__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#include "AWTTextComponent.h"

class AFX_EXT_CLASS AWTTextField : public AWTTextComponent  
{
DECLARE_DYNAMIC(AWTTextField)
public:
	AWTTextField();
	AWTTextField(LPTSTR text);
	AWTTextField(CString& text);
	AWTTextField(int columns);
	virtual ~AWTTextField();

	TCHAR getEchoChar() 
		{return m_echoChar;}
	void setEchoChar(TCHAR ch);
	BOOL echoCharIsSet() 
		{return m_echoChar != '\0';}
	int getColumns() 
		{return m_columns;}
	void setColumns(int columns);
	CSize getPreferredSize(int columns)
		{return preferredSize(columns);}
	CSize preferredSize(int columns);
	CSize getPreferredSize()
		{return preferredSize();}
	CSize preferredSize();
	CSize getMinimumSize(int columns)
		{return minimumSize(columns);}
	CSize minimumSize(int columns);
	CSize getMinimumSize()
		{return minimumSize();}
	CSize minimumSize();

//	void setText(CString& text);
//	CString& getText();

	void addActionListener(AWTActionListener* l) 
		{m_actionListener = AWTEventMulticaster::add(m_actionListener, l);}
  void removeActionListener(AWTActionListener* l) 
		{m_actionListener = AWTEventMulticaster::remove(m_actionListener, l);}
	void processActionEvent(AWTActionEvent* e) 
	{
    if (m_actionListener != NULL) 
			m_actionListener->actionPerformed(e);
  }
//	virtual BOOL isFocusTraversable()
//		{return TRUE;}
	void setUpperCase(BOOL b);
	BOOL getUpperCase()
		{return m_upperCase;}

	void setReadOnly(BOOL b);
	BOOL getReadOnly()
		{return m_readOnly;}

private:
	void construct(CString &text, int columns)
	{
		m_name = text;
		m_text = text;
		m_columns = columns;
		m_echoChar = '\0';
		m_upperCase = FALSE;
		m_readOnly = FALSE;
		m_actionListener = NULL;
		setBackground(AWTColor::white());
		setForeground(AWTColor::black());
	}

protected:
	CWnd* createComponent();

//	CString m_text;
	int m_columns;
  TCHAR m_echoChar;
	AWTActionListener* m_actionListener;
	BOOL m_upperCase;
	BOOL m_readOnly;
};

#endif // !defined(AFX_AWTTEXTFIELD_H__DCE3E985_423F_11D2_A3F2_006097A44215__INCLUDED_)
